package app.r_teenus.backend.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "DEVICE")
public class Device implements Serializable {


	/**
	 * 
	 */
	private static final long serialVersionUID = -8228318649012061732L;
	private Integer id = null;
	private String name = null;
	private String regNo = null;
	private String description = null;
	private String manufacturer = null;
	private DeviceType deviceType = null;
	private String model = null;
	private List<DeviceType> deviceTypeList = null;
	private boolean canRemove = false;
	
	@Transient
	public boolean isCanRemove() {
		return canRemove;
	}

	public void setCanRemove(boolean canRemove) {
		this.canRemove = canRemove;
	}

	/**
	 * Gets id (primary key).
	 */
	@Id
	@Column(name = "DEVICE")
	@SequenceGenerator(name = "device_id", sequenceName = "device_id", allocationSize = 1)
	@GeneratedValue(generator = "device_id")
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "REG_NO")
	public String getRegNo() {
		return regNo;
	}

	public void setRegNo(String regNo) {
		this.regNo = regNo;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getManufacturer() {
		return manufacturer;
	}

	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}

	@OneToOne
	@JoinColumn(name = "DEVICE_TYPE_FK", nullable = false)
	public DeviceType getDeviceType() {
		return deviceType;
	}

	public void setDeviceType(DeviceType deviceType) {
		this.deviceType = deviceType;
	}

	@Transient
	public List<DeviceType> getDeviceTypeList() {
		return deviceTypeList;
	}

	public void setDeviceTypeList(List<DeviceType> deviceTypeList) {
		this.deviceTypeList = deviceTypeList;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

}
